/**
 *                     Remixvym (version 0.8.4)
 *             Copyright (c) 2010 by RemixLab, DISI-UNAL
 *            http://www.disi.unal.edu.co/grupos/remixlab/
 *
 * This Java package provides classes to visualize Mind Maps created in VYM
 * (View Your Mind) in a Processing Sketch
 *
 * @author Alvaro Lopez, Juan Baquero
 *
 * This source file is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 3 of the License, or (at your option)
 * any later version.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * A copy of the GNU General Public License is available on the World Wide Web
 * at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by
 * writing to the Free Software Foundation, 51 Franklin Street, Fifth Floor
 * Boston, MA 02110, USA
 */
package remixlab.remixvym.core.mindmap;
import java.util.ArrayList;
/**
 * Node class contains all the information taken from the XML file.
 * This class defines and setup the attributes for processing and drawing the map.
 */
public class Node {
	/**Contains the text in the node*/
	protected String info;
	//Top-left and bottom-right coordinates
	public int x1 = 0, y1 = 0;
	public int x2 = 0, y2 = 0;
	/**Height of the node*/
	public int height;
	/**Width of the node*/
	public int width;
	/**Name of the contained image, if apply*/
	public String contImage;
	/**Name of the contained video, if apply*/
	public String contVideo;
	/**Name of the contained link, if apply*/
	public String contLink;
	/**Name of the contained sketch, if apply*/
	public String contSketch;
	/**Preferred size of sketch*/
	public int prefsketchWidth;
	public int prefsketchHeight;
	/**List with the names of the emoticons of the node*/
	public ArrayList<String> emoticones = new ArrayList<String>();
	/**List of the children of the node. Null for leaf nodes*/
	public ArrayList<Node> children = new ArrayList<Node>();
	/**Parent's node reference. The parent of the root node consists of info about the map*/
	protected Node father;
	/**Whether it is hidden or no*/
	public boolean hide = false;
	/**Whether it is currently selected and has the focus*/
	public boolean selected =false;
	/**When true, the sketch (if anyone is available) is shown*/
	public boolean showSketch = false;
	/**When true, the image(if anyone is available) is shown*/
	public boolean showImage = false;
	/**When true, the node's children turn into hidden nodes. This property is read from vym file*/
	public boolean scrolled = false;
	/**Checks if the node is actually scrolled or no*/
	public boolean scrolledNow = false;
	/**When true, the video (if anyone is available) is shown*/
	public boolean showVideo = false;
	/**When true, the link (if anyone is available) is activated*/
	public boolean showLink = false;
	
	/**Get the nodeType sepecified to draw the node*/
	public String nodeStyle = "";
	
	/**The level of the node in the map structure*/
	public int level = 1;
	
	/**keeps the size of font, <=0 implies there isn't text*/
	public float fontSize;
	
	/**
	 * Calculate the width and height for the map.
	 */
	public void calculate(){
		width =(x2-x1);
		height = (y2-y1);
	}

	/**
	 * Returns the node information.
	 */
	public String getInfo(){
		return info;
	}
	
	/**
	 * Set the node information.
	 */
	public void setInfo(String info){
		this.info=info;
	}

	/**
	 * Set the father node.
	 * @param father Node object
	 */
	public void setFather(Node father) {
		this.father = father;
	}

	/**
	 * Return the node father.
	 */
	public Node getFather() {
		return father;
	}
	
	/**
	 * Return the node's level.
	 */
	public int getLevel() {
		return level;
	}

	/**
	 * Set the level of the node.
	 * @param level (by default, it is 1)
	 */
	public void setLevel(int level) {
		this.level = level;
	}

}
